export const columns = [
  { label: '', prop: 'index', width: '80px', type: 'index' },
  { label: '业主姓名', prop: 'name', width: '120px', search: true },
  { label: '销售', prop: 'advisorName', width: '150px', search: true },
  { label: '联系电话', prop: 'phone', width: '150px', search: true },
  { label: '楼栋', prop: 'building', width: '120px', search: true },
  { label: '单元', prop: 'unit', width: '120px', search: true },
  { label: '房号', prop: 'roomNum', width: '120px', search: true },
  { label: '状态', prop: 'status', width: '100px', type: 'select', options: $enums.status, search: true },
  { label: '操作', prop: 'action', slotName: 'action', width: '300px', fixed: 'right' },
]

export const formOptions = [
  { label: '业主姓名', prop: 'name' },
  {
    label: '销售',
    prop: 'advisorId',
    type: 'select',
    linkage: 'communityId',
    options: async (params) => {
      try {
        if (!params.communityId) {
          return []
        }
        const res = await $request.get(`/api-parking/parking/advisor/community/${params.communityId}`)
        return (res || []).map((i) => ({ label: i.name, value: i.id }))
      } catch (error) {
        console.log(error)
        return []
      }
    },
  },
  { label: '联系电话', prop: 'phone' },
  { label: '楼栋', prop: 'building' },
  { label: '单元', prop: 'unit' },
  { label: '房号', prop: 'roomNum' },
]
